//package cn.haohaowo.config;
//
//import org.apache.log4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.data.redis.serializer.JdkSerializationRedisSerializer;
//import org.springframework.data.redis.serializer.RedisSerializer;
//import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
//import org.springframework.session.web.http.CookieHttpSessionStrategy;
//import org.springframework.session.web.http.DefaultCookieSerializer;
//
////@Configuration
////@EnableRedisHttpSession(maxInactiveIntervalInSeconds=600)
//public class PageSessionConfig {
//
//	private final static String COOKPATH = "/";
//	private final static Logger log = Logger.getLogger(PageSessionConfig.class);
//
//	@Bean
//	public CookieHttpSessionStrategy getCookieHttpSessionStrategy() {
//		CookieHttpSessionStrategy sessionStrategy = new CookieHttpSessionStrategy();
//		DefaultCookieSerializer defaultCookieSerializer = new DefaultCookieSerializer();
//		defaultCookieSerializer.setCookiePath(COOKPATH);
//		sessionStrategy.setCookieSerializer(defaultCookieSerializer);
//
//		return sessionStrategy;
//	}
//
//	@Bean("springSessionDefaultRedisSerializer")
//	public RedisSerializer getRedisSerializer() {
//		return new ObjectSerializer();
//	}
//
//	public static class ObjectSerializer extends JdkSerializationRedisSerializer {
//		@Override
//		public Object deserialize(byte[] bytes) {
//			try {
//				return super.deserialize(bytes);
//			} catch(Exception e) {
//				log.error("--- That object cann't deserialize, only String !");
//				return null;
//			}
//		}
//	}
//
//}
